package com.ruoyi.course.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.course.domain.LabCourseAdjustDetails;
import com.ruoyi.course.service.ILabCourseAdjustDetailsService;

/**
 * 调课详情Controller
 * 
 * @author jun.wang
 * @date 2022-04-16
 */
@RestController
@RequestMapping("/course/details")
public class LabCourseAdjustDetailsController extends BaseController
{
    @Autowired
    private ILabCourseAdjustDetailsService labCourseAdjustDetailsService;

    /**
     * 查询调课详情列表
     */
//    @PreAuthorize("@ss.hasPermi('course:details:list')")
   /* @GetMapping("/list")
    public TableDataInfo list(LabCourseAdjustDetails labCourseAdjustDetails)
    {
        startPage();
        List<LabCourseAdjustDetails> list = labCourseAdjustDetailsService.selectLabCourseAdjustDetailsList(labCourseAdjustDetails);
        return getDataTable(list);
    }*/

    /**
     * 导出调课详情列表
     */
//    @PreAuthorize("@ss.hasPermi('course:details:export')")
   /* @Log(title = "调课详情", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(LabCourseAdjustDetails labCourseAdjustDetails)
    {
        List<LabCourseAdjustDetails> list = labCourseAdjustDetailsService.selectLabCourseAdjustDetailsList(labCourseAdjustDetails);
        ExcelUtil<LabCourseAdjustDetails> util = new ExcelUtil<LabCourseAdjustDetails>(LabCourseAdjustDetails.class);
        return util.exportExcel(list, "details");
    }
*/
    /**
     * 获取调课详情详细信息
     */
    @PreAuthorize("@ss.hasPermi('course:adjust:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(labCourseAdjustDetailsService.selectLabCourseAdjustDetailsById(id));
    }

    /**
     * 新增调课详情
     */
    @PreAuthorize("@ss.hasPermi('course:details:edit')")
    @Log(title = "调课详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LabCourseAdjustDetails labCourseAdjustDetails)
    {
        return toAjax(labCourseAdjustDetailsService.insertLabCourseAdjustDetails(labCourseAdjustDetails));
    }

    /**
     * 修改调课详情
     */
    @PreAuthorize("@ss.hasPermi('course:details:edit')")
    @Log(title = "调课详情", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LabCourseAdjustDetails labCourseAdjustDetails)
    {
        return toAjax(labCourseAdjustDetailsService.updateLabCourseAdjustDetails(labCourseAdjustDetails));
    }

    /**
     * 删除调课详情
     */
    @PreAuthorize("@ss.hasPermi('course:details:edit')")
    @Log(title = "调课详情", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(labCourseAdjustDetailsService.deleteLabCourseAdjustDetailsByIds(ids));
    }
}
